<?php
/**
******************************************************************************
******************************************************************************
 * @name        ConfigurationManager.php
 * @package     common/util
 * 
 * @author      j.garcia@irobase.net
 * @date        10 déc. 08
 *                   
******************************************************************************
*/


/**
 * Enter description here...
 * @package common/util
 *
*/
class ConfigurationManager {

    
    static private $_instanceOfFactory = null;
    
    /**
     * @var settings held here
     */
    static private $_data = array();
    
    
    //*************************************************************************
    //*************************************************************************

    // private constructor
    private function __construct() {}
    
    /**
     * Enter description here...
     *
     * @return ConfigurationManager
     */
    public static function getInstance() {
        if (self::$_instanceOfFactory == null) {
            self::$_instanceOfFactory = new self;
        }
        
        return self::$_instanceOfFactory;        
    }
    
    
    /**
     * magic method called when overloading the object
     *  
     * @param $key
     * @param $value
     * @return unknown_type
     */
    public static function set($key,$value) {
        self::$_data[$key] = $value;
        return true;
    }

    
    /**
     * Method called when retrieving overloaded object member
     *  
     * @param $key
     * @return unknown_type
     */
    public static function get($key) {
        if(array_key_exists($key,self::$_data)) {
            return self::$_data[$key];
        } else {
            return null;
        }
    }

    
    /**
     * Prevent cloning
     * @return unknown_type
     */
    private function __clone() {
        // @todo lancer une exception !
    }

}
 
?>